import { defineStore } from 'pinia';
import { createDiscreteApi } from 'naive-ui';
import { createVNode } from 'vue';

const {dialog} = createDiscreteApi(["dialog"]);

export const usedialogStore = defineStore('dialogwrapper',{
    state: () => ({
        dialogInstance:null,
    }),
    actions:{
        openDialog(component) {
            this.codeInstance = dialog.create({
              content: () => createVNode(component),
              showIcon: false,
              style: "width:604px;height:543px;border-radius: 25px; border: 2px solid;",
              closable: false
            });
          },
          closeDialog() {
            dialog.destroyAll();
          },
      }
    }
)